from urllib.request import *
from fake_useragent import *
import ssl

# 忽略验证证书案例

url = "https://www.12306.cn/index/"

headers = {
    "User-agent": UserAgent().chrome
}

request = Request(url, headers=headers)

# 忽略验证证书
context = ssl._create_unverified_context()

response = urlopen(request, context=context)

print(response.read().decode())
